package com.sunchen.asc.service.parameter.repository;

import com.sunchen.asc.service.parameter.domain.Param;
import com.sunchen.asc.service.parameter.vo.ParamVo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface ParamRepository extends JpaRepository<Param,Long> {

    Long countByTitleAndDeleteFlag(String title, int i);

    Long countByValue1AndDeleteFlag(String value, int i);

    @Query("select new com.sunchen.asc.service.parameter.vo.ParamVo(t.id,t.title,t.value1,t.value2,t.valueFlag,t.typeId,t.fixed) from Param t where t.typeId = ?1 and t.deleteFlag = 0")
    List<ParamVo> findVoByTypeId(Long typeId);
}
